package com.qq2008.game.mojie.interceptor;

import com.qq2008.game.mojie.utils.CommonUtil;
import com.qq2008.game.mojie.utils.DateUtil;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


// 全局信息
public class SessionInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
        request.setAttribute("host", request.getScheme() + "://" + request.getServerName());
        request.setAttribute("date", CommonUtil.getDate());
        request.setAttribute("time", CommonUtil.getTime());
        request.setAttribute("kit", new DateUtil());
        return true;
    }

}
